<html>
<div id="myheader">
<?php
error_reporting(E_ALL);
?>
</div>
<title>OSPMS</title>
<head>

<style type="text/css" media="all">
.ImgDiv{width:100%;}
</style>
</head>
<div id="mybody">
<?php
echo "<div class='imgDiv'>";
include "../include/dbConfig.php";
try {
	$conn = new PDO("mysql:host=$dbservername;dbname=$dbname", $dbusername, $dbpassword);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$select = $conn->query('SELECT * FROM user_programs');

$total_column = $select->columnCount();
//var_dump($total_column);

for ($counter = 0; $counter <= $total_column; $counter ++) {
    $meta = $select->getColumnMeta($counter);
    $column[] = $meta['name'];
}
//print_r($column);

    $stmt = $conn->prepare("SELECT program_id, project_id, program_name, program_location FROM user_programs");
    $stmt->execute();
    $result2 = $stmt->setFetchMode(PDO::FETCH_ASSOC);
    $result2 = $stmt->fetchAll();
//    var_dump($result2);
    $my_count = count($result2);
    echo ' ';

    for( $i=0; $i<1; $i++ )
    {
    	$my_file_id = $result2[$i]['file_id'];
    	$my_folder_id = $result2[$i]['folder_id'];
    	$my_filename = $result2[$i]['file_name'];
    	$my_location = $result2[$i]['file_location'];

    $user_dir = "/var/www/uploads/SAVED";

   
    $maxtime = CF_MAXTIME;
    $maxsize = CF_MAXSIZE;

    set_time_limit($maxtime);

    passthru("cd ".$user_dir. "; octave sim1.m ");

echo '<ol><li><img src="https://test2.transpolink.com/uploads/SAVED/00000.png" /></li></ol>';

    }


//    $dsn = null;
    }
catch(PDOException $e)
    {
    echo "Error: " . $e->getMessage();
    }
$conn = null;
echo "</div>";
?> 

</div>
</div>


